{extend name="adminheader:header"/}
{block name="content"}
    <body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>修改轮播图</h5>
                    </div>
                    <div class="ibox-content">
                        <form action="{:url('/admin/Flash/editPost')}" method="post" class="form-horizontal js-ajax-form m-t">
                            <input type="hidden" name="id" value="{$list.id}" />
                            <div class="form-group">
                                <label class="col-sm-3 control-label">商品名称<span class="form-required">*</span></label>
                                <div class="col-md-6 col-sm-10">
                                     <select class="form-control" name="gid">
                                        <option value="">- - - 请选择商品 - - -</option>
                                        {if condition="$goods neq null"}
                                            {volist name="goods" id="vo"}
                                                <option value="{$vo.id}" {$list['gid']==$vo['id']?'selected':''}>{$vo.g_name}</option>
                                            {/volist}
                                        {else/}
                                            <option value="" disabled="disabled">暂时无商品</option>
                                        {/if}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">轮播图<span class="form-required">*</span></label>
                                <div class="col-md-6 col-sm-10">
                                    <input type="hidden" name="pic" id="thumbnail" value="{$list.pic|default=''}">
                                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                        {if condition="empty($list.pic)"}
                                            <img src="/static/img/default-thumbnail.png" id="thumbnail-preview" width="100" height="100" style="cursor: pointer"/>
                                        {else/}
                                            <img src="{:getPreviewUrl($list.pic)}" id="thumbnail-preview" width="100" height="100" style="cursor: pointer"/>
                                        {/if}
                                    </a>
                                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">状态<span class="form-required">*</span></label>
                                <div class="col-md-6 col-sm-10">
                                   <input type="radio" name="status" id="inlineRadio1" value="1" {$list.status ==1 ? 'checked':''} style="cursor: pointer;margin-right:5px"/>新添加&nbsp;&nbsp;&nbsp;&nbsp;
                                   <input type="radio" name="status" id="inlineRadio2" value="2" {$list.status ==2 ? 'checked':''} style="cursor: pointer;margin-right:5px"/>上架&nbsp;&nbsp;&nbsp;&nbsp;
                                   <input type="radio" name="status" id="inlineRadio3" value="3" {$list.status ==3 ? 'checked':''} style="cursor: pointer;margin-right:5px"/>过期
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">添加时间<span class="form-required">*</span></label>
                                <div class="col-md-6 col-sm-10">
                                    <input class="form-control js-bootstrap-datetime" type="text" name="addtime" value="{:date('Y-m-d H:i',$list['addtime'])}" />
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3">
                                    <button class="btn btn-primary js-ajax-submit" type="submit" id="btn">保存</button>
                                    <a class="btn btn-default" href="{:url('/admin/Flash/index')}">返回</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="/admin/js/admin.js"></script>
<script type="text/javascript">
    $(function () {

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '/static/img/default-thumbnail.png');
            $('#thumbnail').val('');
        });
    });
</script>
{/block}